/*
 * @Author: HeAo
 * @Date: 2021-09-28 09:07:36
 * @LastEditTime: 2021-09-28 09:25:12
 * @LastEditors: HeAo
 * @Description:
 * @FilePath: \web2103-2105\web2103code\3-1-ES6\day04\1-class.js
 * 别乱动！
 */
class Person {
  // 静态属性，使用static关键字来修饰
  static weight = '50KG'
  // 构造器，里面声明实例属性
  constructor(name, age, gender) {
    this.name = name
    this.age = age
    this.gender = gender
  }
  // 实例方法，不需要任何关键字修饰
  sayName () {
    console.log('my name is', this.name);
  }
  chageAge () {
    this.age++
  }
  // 静态方法，需要用static关键字来修饰
  static sayWeight () {
    console.log(this.weight);
  }
}
// 实例化
let tom = new Person('tom', 20, '男')
tom.chageAge()

console.log(tom);
tom.sayName()

// 通过class类来调用静态属性和方法
console.log(Person.weight);
Person.sayWeight()